using System;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using log4net;
using WEB.DAL.DBManagers;
using WEB.BLL.Entities;
using WEB.Exceptions;
namespace WEB.BLL.Services
{
	#region IDesktopService

	/// <summary>
	/// DesktopService object for Ibatis mapped table 'Desktop'.
	/// </summary>
	public class IDesktopService : BaseSqlMapDao
	{
		private static readonly ILog log = LogManager.GetLogger(typeof(IDesktopService).Name);

        public IList<DesktopEntity> LoadAll(DesktopEntity objE)
        {
            try
            {
                return ExecuteQueryForList<DesktopEntity>("DesktopLoadAll", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
       public DesktopEntity LoadByPrimaryKey(DesktopEntity objE)
        {
            try
            {
                return ExecuteQueryForObject< DesktopEntity>("DesktopLoadByPrimaryKey", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message,ex);
            }
        }
        
        /// <summary>
        /// add new Desktop to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Insert(DesktopEntity objE)
        {
            try
            {
                ExecuteInsert("DesktopInsert", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message,ex);
            }
        }
        /// <summary>
        /// update Desktop to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Update(DesktopEntity objE)
        {
            try
            {
                ExecuteUpdate("DesktopUpdate", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message,ex);
            }
        }
        /// <summary>
        /// delete Desktop to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Delete(DesktopEntity objE)
        {
            try
            {
                ExecuteDelete("DesktopDelete", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message,ex);
            }
        }
	}
	#endregion  
}
